package com.zhiwei.controller;

import com.zhiwei.pojo.Products;
import com.zhiwei.service.ProductsService;
import com.zhiwei.vo.SysResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

@RestController
@CrossOrigin
@RequestMapping("/products")
public class ProductsController {
    @Autowired
    private ProductsService productsService;
    @GetMapping("/allList")
    public SysResult getProductLists(){
        Map<Integer, Products> products = productsService.getProductLists();
        return SysResult.success(products);
    }
}
